perm filename FOO[TEX,ALS] blob
sn#616947 filedate 1981-10-12 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00012 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 Module SYSDEP
C00004 00003 Module TEX
C00006 00004 Counts for page 21
C00009 00005 Counts for page 18
C00012 00006 Counts for page 13
C00017 00007 Counts for page 11
C00019 00008 Counts for page 10
C00020 00009 Counts for page 9
C00021 00010 Counts for page 6
C00024 00011 Counts for page 4
C00026 00012 Threshold=40000
C00028 ENDMK
C⊗;
Module SYSDEP
Counts for page 1
Line 734 count 114208
PROCEDURE Dvi(byte:integer); BEGIN outfil↑:=byte; put(outfil); END;
Note: This procedure is called by TEX.PAS in 133 different places.
As now written, it contains an unnecessary conditional statement that can
be eliminated by expanding the case 4 code that precedes it to include the
necessary output calls, the resetting of DVIWORD, etc.
A considerable saving could be achieved by having a temporary byte storage
region, say, of 64 words that would be filled before DVI was called.
instead of DVI(byte) one would write:
bytesave(savecount):=byte; savecount:=savecount+1; if savecount= 64 then dvisave;
where the savecount increment would replace the present dvibytecount increment
and dvibytecount would be updated in units of 64 in dvisave.
This would add 133 lines of code to TEX.PAS but it would save 114208*7 or
more executed instructions for the job reported here.
Altogether, several seconds in execution time would be saved by this
change alone.
Module TEX
Counts for page 24
Line 379 thru 380 count 41014
BEGIN processchar;
GOTO 2;
Line 270 count 66518
CASE abs(mode)+curcmd OF
Counts for page 21
Line 388 count 41014
Line 370 count 52884
Line 368 count 69103
368 IF(lkstep.byte0>=128)
THEN GOTO 0;
370 j:=j+1
Line 327 thru 330 count 71183
lkstep:=fmem[j].fourbytes;
IF(lkstep.byte1=curchar)
AND((curcmd=11) OR(curcmd=12))
THEN BEGIN llchar:=lchar;
lchar:=curchar;
curchar:=lkstep.byte3;
Line 316 thru 323 count 41254
Line 310 count 41254
Line 308 count 41014
Line 302 thru 303 count 41014
Counts for page 18
Line 598 count 64249
q:=mem[q].twohalves.lhword
Line 321 thru 324 count 44554
Line 311 thru 314 count 44554
Line 310 count 64249
IF((q>25000)) THEN
WITH mem[q].twohalves
IF(lastfont<>byte2) THEN
BEGIN lastfont:=byte2;
dvi(fontnum+byte2);
fontused[byte2]:=1;
dvibytecnt:=dvibytecnt+1;
END;
dvi(byte3);
dvibytecnt:=dvibytecnt+1;
x:=x+charwd(byte2,byte3)
END
ELSE CASE mem[q].twohalves.byte2
OF
4: BEGIN
DO
BEGIN
Counts for page 13
Line 408 thru 410 count 54360
prevp:=p;
p:=mem[p].twohalves.lhword;
Line 284 thru 301 count 40387
Line 282 thru 283 count 54360
IF(p>25000) THEN
WITH mem[p].twohalves
DO
BEGIN
curwd:=curwd+charwd(byte2,byte3);
END
ELSE CASE mem[p].twohalves.byte2
Line 57 thru 59 count 41069
r:=mem[prevr].int;
WITH mem[r+5].twohalves DO l:=lhword;
IF(r=0) OR(l>oldl) THEN
Counts for page 11
Line 198 count 64830
Line 194 thru 195 count 64829
prevp:=p;
p:=mem[p].twohalves.lhword;
Line 117 thru 127 count 42838
Line 115 thru 116 count 64830
IF(p>25000) THEN BEGIN
WITH mem[p].twohalves
DO BEGIN f:=byte2;
Counts for page 10
Line 398 thru 401 count 85179
FUNCTION charwd(f:integer; c: asciicode):real;
VAR displacement: integer;
BEGIN
displacement:=fontinfo[f,c].byte0;
charwd:=fmem[wdbase[f]+displacement].pts
END;
A lot of function-calling overhead could be eliminated by making this into
a DOC macro so it would be compiled in line. This would actually reduce the
size of PTEX , but only slightly since this function is called only 5 times.
Counts for page 9
Line 422 thru 423 count 67649
p:=q;
END;
Line 395 thru 397 count 67649
q:=mem[p].twohalves.lhword;
IF(p>25000) THEN freeavail(p)
Counts for page 6
Line 359 count 43639
Line 343 thru 344 count 41137
Line 336 thru 342 count 43904
Line 335 count 43640
Line 287 count 130343
PROCEDURE startunsetnode;
BEGIN
WITH curinput DO
BEGIN
pushnest;
IF mode=-84 THEN aux.pts:=1.0
This procedure is called only twice
Line 277 count 130856
PROCEDURE startalignbox;
BEGIN
pushnest;
mode:=-(85)-mode;
IF abs(mode)=84 THEN aux.pts:=1.0
ELSE aux.pts:=
-(1000000.0*1000000.0*1000000.0*1000000.0*1000000.0);
alignrecord:=mem[alignlist].twohalves.lhword
END;
This procedure is called only once, so some time and code could be saved
by putting it in line.
Line 272 count 43508
Line 235 thru 243 count 61281
Line 234 count 79178
234 ELSE IF loc<>0 THEN BEGIN
235 BEGIN curcmd:=mem[loc].twohalves.byte2;
curchar:=mem[loc].twohalves.byte3;
loc:=mem[loc].twohalves.lhword
END;
Line 164 count 41226
Line 94 thru 97 count 71758
Line 93 count 73612
93 IF curbuf<=bufptr THEN BEGIN
94 curchar:=buffer[curbuf];
curcmd:=eqtb[curchar+1137].int;
curbuf:=curbuf+1;
CASE state+curcmd OF
Line 91 thru 92 count 149517
WITH curinput DO IF state<>0 THEN 2:
Counts for page 4
Line 84 thru 88 count 86945
called 10 times
PROCEDURE freeavail(p: integer);
BEGIN
IF p<25012 THEN freenode(p,2)
ELSE BEGIN mem[p].twohalves.lhword:=mem[49152].twohalves.lhword;
mem[49152].twohalves.lhword:=p;
END
END;
It would look as if the p<25012 branch is never taken. If this is so a lot
of time could be saved by deleting this line of code.
Line 78 thru 80 count 97997
Line 74 thru 75 count 97997
called 51 times
FUNCTION getavail: integer;
VAR p: integer;
BEGIN
p:=mem[49152].twohalves.lhword;
IF p<>0 THEN mem[49152].twohalves
.lhword:=mem[mem[49152].twohalves.lhword].twohalves.lhword
ELSE overflow(133,49152);
mem[p].twohalves.lhword:=0;
getavail:=p;
END;
Line 25 thru 26 count 42947
Line 10 thru 12 count 42947
Threshold=40000
(* drf:
for first third of v233.
by the way, the source file for TEX was TEX.PAS[TEX,ALS]
*)